package bo;

import java.util.ArrayList;

public class Product {
	/*Produktens egenskaper*/
	private String img;
	private String name;
	private String descr;
	private String price;
	private String id;
	private String q;
	private String cat;

	/**En produkt med sju egenskaper
	 * @param img = URL till produktbild.
	 * @param name = namn.
	 * @param descr = beskrivning.
	 * @param price = pris.
	 * @param id = produkt-ID.
	 * @param q = kvantitet/lagersaldo.
	 * @param cat = produktkategori.*/
	public Product (String img, String name, String descr, String price, String id, String q, String cat) {
		this.img = img;
		this.name = name;
		this.descr = descr;
		this.price = price;
		this.id = id;
		this.q = q;
		this.cat = cat;
	}
	
	
	public ArrayList<String> getAttributesAsArrayList(){
		ArrayList<String> arrList = new ArrayList<String>();
		arrList.add(this.img);
		arrList.add(this.name);
		arrList.add(this.descr);
		arrList.add(this.price);
		arrList.add(this.id);
		arrList.add(this.q);
		arrList.add(this.cat);
		return arrList;
	}
	
	public String[] getAttributesAsStringArray(){
		String[] arrStrings = new String[7];
		arrStrings[0] = this.img;
		arrStrings[1] = this.name;
		arrStrings[2] = this.descr;
		arrStrings[3] = this.price;
		arrStrings[4] = this.id;
		arrStrings[5] = this.q;
		arrStrings[6] = this.cat;
		return arrStrings;
	}
	
	public int getNumberOfAttributes() {
		int n = getAttributesAsArrayList().size();
		return n;
	}
	

}
